<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    var arr = [1, 1, 2, 3, 4, 4, 2, 1, 3, 5]

    function norepeat() {
        var arr1=[]
        var length=arguments[0].length
        for(var i=0;i<length;i++)
        {
            var j=arguments[0].shift();
            if(arr1.indexOf(j)<0)
            arr1.push(j)
        }
        return arr1;
    }
    
    console.log(norepeat(arr)) // [1, 2, 3, 4, 5]
    </script>
</body>
</html>